package com.black.web.controller.exercise.personalize;

import com.black.app.domain.req.exercise.query.AppExercisePersonalizeQueryReq;
import com.black.app.domain.resp.exercise.AppExercisePersonalizeResp;
import com.black.app.service.exercise.AppExercisePersonalizeService;
import com.black.common.core.controller.BaseController;
import com.black.common.core.domain.R;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(tags = "后台-锻炼私人定制Personalize的Api")
@RestController
@RequestMapping(value = "/admin/exercise/personalize")
public class AdminExercisePersonalizeController extends BaseController {
    @Autowired
    private AppExercisePersonalizeService appExercisePersonalizeService;
    /*
     * 分页查询
     * */
    @PreAuthorize("@ss.hasPermi('exercise:personalize:list')")
    @ApiOperation(value = "分页查询")
    @GetMapping("/list")
    public R<PageInfo<AppExercisePersonalizeResp>> pagination(AppExercisePersonalizeQueryReq req){
        PageInfo<AppExercisePersonalizeResp> page = this.appExercisePersonalizeService.paginationQuery(req);
        return R.ok(page);
    }
    /*
    * 根据id查询
    * */
    @PreAuthorize("@ss.hasPermi('exercise:personalize:query')")
    @ApiOperation(value = "根据id查询")
    @GetMapping("/{id}")
    public R<AppExercisePersonalizeResp> findById(@PathVariable(value = "id") Long id){
        AppExercisePersonalizeResp resp=this.appExercisePersonalizeService.findById(id);
        return R.ok(resp);
    }
}
